Cyberhaven API
Summary: Steps to test the output of events from the API within the Cyberhaven console. Question_md: How can I test the API Authentication and testing capabilities to validate the output of events from the API within the console?
Answer_md: 1. Create the API key.
- In the Cyberhaven Console, navigate toSettings > Users & API keys.
-
Select New API Key , enter a Name, select a Role and select a date range during which the API key is valid.
-
Save it.
-
Copy the value and save it in a safe place.
- Now that we have an API key we have to query the API for an access_token which. Note: This token will need to be refreshed as it expires in 15 min.
If the api-token field has a value set, clear and remove all values before proceeding. No API key applied is the desired state for this initial step.
This can be done in https://console_url/administration/api-specifications#auth
- Go to https://console_url/administration/api-specifications#post-/v2/auth/token/access , click on Example and replace "string" with the API token generated on Step 1, click Try button.
- At this point, all API’s will have the Bearer token, like this and you will be able to test all the available API’s
curl -X GET "<https://console_url/public/v2/event-details>" -H "accept:application/json" -H "Authorization: Bearer token"